<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
  
</style>
<body>

    <div id="hello">
        <h2 v-bind:style="{fontSize:size,backgroundColor:bgc}">{{message}}</h2>
        <h2 :style="getStyle()">hello</h2>
    </div>
    <script src="../vue.js"></script>
    <script>
        const vue01 = new Vue({
            el: '#hello',
            data: {
                message: 'hello vuejs',
                size:'50px',
                bgc:'red',
            },
            methods: {
                getStyle:function(){
                    // 返回一个对象
                    return {fontSize:this.size,backgroundColor:this.bgc};
                }
            },
        })
    </script>
</body>

</html>